'use client';

// 操作栏组件 - 分享码预览和批量导入按钮
// REF: API-SHARE189-004@v1.0

import React, { useState } from 'react';
import { Eye, Upload, Zap, FileSearch, PackageOpen } from 'lucide-react';

import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { ShareCodePreviewDialog } from './ShareCodePreviewDialog';
import { BatchImportDialog } from './BatchImportDialog';

interface ActionBarProps {
  onRefresh: () => void;
}

export function ActionBar({ onRefresh }: ActionBarProps) {
  const [previewDialogOpen, setPreviewDialogOpen] = useState(false);
  const [batchImportDialogOpen, setBatchImportDialogOpen] = useState(false);

  return (
    <>
      {/* 简化的功能操作区域 */}
      <div className="flex items-center gap-3 mb-6">
        <Button
          onClick={() => setPreviewDialogOpen(true)}
          variant="outline"
          className="flex items-center gap-2"
        >
          <FileSearch className="h-4 w-4" />
          预览解析
        </Button>
        
        <Button
          onClick={() => setBatchImportDialogOpen(true)}
          className="flex items-center gap-2"
        >
          <PackageOpen className="h-4 w-4" />
          批量导入
        </Button>
      </div>

      {/* 预览对话框 */}
      <ShareCodePreviewDialog
        open={previewDialogOpen}
        onOpenChange={setPreviewDialogOpen}
        onRefresh={onRefresh}
      />

      {/* 批量导入对话框 */}
      <BatchImportDialog
        open={batchImportDialogOpen}
        onOpenChange={setBatchImportDialogOpen}
        onRefresh={onRefresh}
      />
    </>
  );
}

export default ActionBar;